class Graph:
    def __init__(self, v_num):
        # v_num为顶点数量
        self.v_num = v_num
        self.vertices = [None] * v_num

    def get_v_num(self):\
        return self.v_num

    def get_vertices(self):
        return self.vertices

    def add_vertex(self, vertex):
        self.vertices[vertex.val] = vertex


class Vertex:
    def __init__(self, val):
        self.val = val
        self.adj_list = []

    def get_adj(self):
        return self.adj_list

    def add_adj(self, adj):
        self.adj_list.append(adj)


class TreeNode:
    def __init__(self, val):
        self.val = val
        self.left = None
        self.right = None
